#include <stdio.h>
#include "re.h"

int main(void){
  NFANode* pattern = r_re_compile("(abc|def)+z", 0);
  char* s = "abcdefabcabczywywywy";
  int id, len;
  if (r_re_match(s, pattern, false, &id, &len))
    printf("matched %d successfuly for %d chars!\n", id, len);
  char* s2 = "abcdefdefy";
  if (not r_re_match(s2, pattern, false, &id, &len))
    printf("didn't match successfuly!\n");
  NFANode* pat2 = r_re_compile("(a|b)+", 0);
  char* s3 = "abababzzz";
  if (r_re_match(s3, pat2, false, &id, &len))
    printf("lazy matched %d successfuly for %d chars!\n", id, len);
  if (r_re_match(s3, pat2, true, &id, &len))
    printf("greedy matched %d successfuly for %d chars!\n", id, len);
  return 0;
}
